package cloud.juxue.message;

import cloud.juxue.protodto.BinLogInfo;
import com.alibaba.fastjson.JSONObject;
import com.google.protobuf.InvalidProtocolBufferException;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @Description TODO
 * @Date 15:10 2021/10/20
 * @Version 1.0
 * @AUTHOR by yhsh
 */
@Component
public class MessageConsumer {

    @KafkaListener(id="cosu2",idIsGroup = false,containerGroup = "mycat", groupId = "mycat1",topics = {"demo"})
    private void MessageDataRevicer(ConsumerRecord<String, byte []> records) {
        try {
            BinLogInfo.Binlog bin = BinLogInfo.Binlog.parseFrom(records.value());
            System.out.println(bin.toString());
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
